package gdut.jmxywz.action;

import gdut.jmxywz.util.RandomNumUtil;

import java.io.ByteArrayInputStream;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class RandomImageAction extends ActionSupport {
	
	private ByteArrayInputStream inputStream;
	
	private RandomNumUtil randomNumUtil;

	public ByteArrayInputStream getInputStream() {
		return inputStream;
	}

	public void setInputStream(ByteArrayInputStream inputStream) {
		this.inputStream = inputStream;
	}

	public RandomNumUtil getRandomNumUtil() {
		return randomNumUtil;
	}

	public void setRandomNumUtil(RandomNumUtil randomNumUtil) {
		this.randomNumUtil = randomNumUtil;
	}

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		RandomNumUtil randomNU=randomNumUtil.Instance();
		this.setInputStream(randomNU.getImage());
		ActionContext.getContext().getSession().put("random", randomNU.getString());
		return SUCCESS;
	}

	
}
